//
//  GPSwizzled.m
//  StudyDemo01
//
//  Created by 心晨 on 2024/7/21.
//

#import "GPSwizzled.h"
#import <objc/runtime.h>

@implementation GPSwizzled

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        SEL methodASEL = @selector(methodA);
        SEL methodBSEL= @selector(methodB);
        
        Method methodA = class_getInstanceMethod(self, methodASEL);
        Method methodB = class_getInstanceMethod(self, methodBSEL);
        
        class_replaceMethod(self, methodASEL, method_getImplementation(methodB), method_getTypeEncoding(methodB));
        
//        method_exchangeImplementations(methodA, methodB);
        
    });
}

- (void)methodA {
    NSLog(@"methodA methodA ");
}

- (void)methodB {
    NSLog(@"methodB methodB ");
}

@end
